package cn.iocoder.yudao.module.wms.dal.mysql.checkvouch;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wms.dal.dataobject.checkvouch.CheckvouchDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wms.controller.admin.checkvouch.vo.*;

/**
 * 盘点 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CheckvouchMapper extends BaseMapperX<CheckvouchDO> {

    default PageResult<CheckvouchDO> selectPage(CheckvouchPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CheckvouchDO>()
                .eqIfPresent(CheckvouchDO::getCode, reqVO.getCode())
                .betweenIfPresent(CheckvouchDO::getDdate, reqVO.getDdate())
                .eqIfPresent(CheckvouchDO::getCmemo, reqVO.getCmemo())
                .betweenIfPresent(CheckvouchDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CheckvouchDO::getId)
                .likeIfPresent(CheckvouchDO::getCode, reqVO.getCode())
                .eqIfPresent(CheckvouchDO::getWarehouseId, reqVO.getWarehouseId())
                .eqIfPresent(CheckvouchDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(CheckvouchDO::getLocationId, reqVO.getLocationId())
                .eqIfPresent(CheckvouchDO::getPersonId, reqVO.getPersonId())

        );
    }

    CheckvouchsRespVO findCheckvouchsById(Integer id);
    void updateStatus(CheckvouchSaveReqVO checkvouchSaveReqVO);
    CheckvouchDO findByProcessInstanceId(String processInstanceId);
}